package com.xtravel.common.share;

import android.view.Gravity;
import android.view.View;
import cn.sharesdk.framework.TitleLayout;
import cn.sharesdk.framework.authorize.AuthorizeAdapter;
import com.xtravel.R;

/**
 * Created by Memory on 15-8-15.
 */
public class XtravelAuthorizeAdapter extends AuthorizeAdapter {

    public void onCreate(){
        hideShareSDKLogo();
        //获取标题栏控件
        TitleLayout llTitle = getTitleLayout();

        //标题栏背景颜色的修改(默认是一张黑色背景的图片,我们修改成灰色背景)
        llTitle.setBackgroundColor(getActivity().getResources().getColor(R.color.cl_caption));

        //标题栏文字居中
        llTitle.getTvTitle().setGravity(Gravity.CENTER);
        final float scale = getActivity().getResources().getDisplayMetrics().density;
        int paddingLeft = (int) (50 * scale + 0.5f); // 50dp
        llTitle.getTvTitle().setPadding(0, 0, paddingLeft, 0);

        //设置返回按钮样式
        llTitle.getBtnBack().setImageDrawable(getActivity().getResources().getDrawable(R.drawable.ic_top_back));

        //隐藏返回按钮后面的黑线
		llTitle.getChildAt(1).setVisibility(View.GONE);
    }
}
